package com.rfid.common;

import android.content.Context;

public abstract class Door {

    protected CallBack mCallBack;

    public boolean init(Context context) {
        return false;
    }

    public void destroy() {
    }

    public abstract void open();

    public abstract  void close();

    public void setCallBack(CallBack callBack) {
        mCallBack = callBack;
    }

    protected void dispatchDoorOpend() {
        if(mCallBack != null) {
            mCallBack.onDoorOpened();
        }
    }

    protected void dispatchPersionApproach() {
        if(mCallBack != null) {
            mCallBack.onPersonApproach();
        }
    }

    public interface CallBack{

        public void onDoorOpened();

        public void onPersonApproach();
    }
}
